package com.service;

import io.lettuce.core.RedisClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class RedisService {
    @Autowired
    private RedisTemplate redisTemplate;

    public void doTh(){
        ValueOperations valueOperations = redisTemplate.opsForValue();
        valueOperations.set("a","44444");
    }
    public void getdo(){
        ValueOperations valueOperations = redisTemplate.opsForValue();
        Object a = valueOperations.get("a");
        log.info("获取的值为"+a);

    }

}
